﻿using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Windows.Forms;

namespace PreProcessingLanguage
{
    class Program
    {
        [STAThreadAttribute]
        static void Main(string[] args)
        {
            //Console.WriteLine("**********************************Error Show:**********************************");
            //Application.Run(new MainForm());

            //NgramSql ngs = new NgramSql();
            //Console.WriteLine(ngs.getKq(ngs.process("nhat ban")));
            //Console.WriteLine(ngs.getKq(ngs.process("con nguoi")));
            //Console.WriteLine(ngs.getKq(ngs.process("viet nam than yeu")));
            //Console.WriteLine(ngs.getKq(ngs.process("viet nam toi yeu")));
            //Console.WriteLine(ngs.getKq(ngs.process("viet nam than yeu")));
            //Console.WriteLine(ngs.getKq(ngs.process("toi yeu viet nam")));
            //Console.WriteLine(ngs.getKq(ngs.process("ai do")));
            //Console.WriteLine(ngs.getKq(ngs.process("that bai")));
            //Console.WriteLine(ngs.getKq(ngs.process("khong the")));
            //Console.ReadKey();

            //Ngram ng = new Ngram();
            //ng.readData("1word_P.txt", "2word_P.txt", "3word_P.txt");
            //Console.WriteLine(ng.getKq(ng.process("nhat ban")));
            //Console.ReadKey();

            //UploadData ud = new UploadData();
            //ud.readData("1word_P.txt", "2word_P.txt", "3word_P.txt");

            //Statistics.StatisticsProbability s = new Statistics.StatisticsProbability();
            //s.readData(@"C:\Users\LaiDuyHoang\Documents\Visual Studio 2012\Projects\PreProcessingLanguage\PreProcessingLanguage\bin\Debug\1word_P.txt");
            //s.statistic();
            //s.writeData("P100.txt", "P95.txt", "P90.txt", "P80.txt", "P70.txt");



            //PreProcessing p = new PreProcessing();
            //Console.WriteLine("Moi nhap vao duong dan noi dung:");
            //string path = Console.ReadLine();
            //string[] files = Directory.GetFiles(path, "*.txt",
            //                             SearchOption.AllDirectories);
            //Console.WriteLine("Processing 1 word....");
            //Stopwatch st = Stopwatch.StartNew();
            //string page = "";
            //foreach (string link in files)
            //{
            //    page = File.ReadAllText(link);
            //    p.xuLy1(page);
            //}
            //st.Stop();
            //Console.WriteLine("Processed, time to elapse: " + st.Elapsed);
            //Console.WriteLine("Writing data...");
            //p.writeData("1word.txt");
            //Console.WriteLine("Conpleted.");
            //p.clear();
            //files = Directory.GetFiles(path, "*.txt",
            //                             SearchOption.AllDirectories);
            //Console.WriteLine("Processing 2 word....");
            //st = Stopwatch.StartNew();
            //page = "";
            //foreach (string link in files)
            //{
            //    page = File.ReadAllText(link);
            //    p.xuly2(page);
            //}
            //st.Stop();
            //Console.WriteLine("Processed, time to elapse: " + st.Elapsed);
            //Console.WriteLine("Writing data...");
            //p.writeData("2word.txt");
            //Console.WriteLine("Conpleted.");
            //p.clear();
            //files = Directory.GetFiles(path, "*.txt",
            //                             SearchOption.AllDirectories);
            //Console.WriteLine("Processing 3 word....");
            //st = Stopwatch.StartNew();
            //page = "";
            //foreach (string link in files)
            //{
            //    page = File.ReadAllText(link);
            //    p.xuly3(page);
            //}
            //st.Stop();
            //Console.WriteLine("Processed, time to elapse: " + st.Elapsed);
            //Console.WriteLine("Writing data...");
            //p.writeData("3word.txt");
            //Console.WriteLine("Conpleted.");
            //p.clear();
            //files = Directory.GetFiles(path, "*.txt",
            //                             SearchOption.AllDirectories);
            //Console.WriteLine("Processing 1 word US....");
            //st = Stopwatch.StartNew();
            //page = "";
            //foreach (string link in files)
            //{
            //    page = File.ReadAllText(link);
            //    p.xuLy1(PreProcessing.ConvertToUnSign(page));
            //}
            //st.Stop();
            //Console.WriteLine("Processed, time to elapse: " + st.Elapsed);
            //Console.WriteLine("Writing data...");
            //p.writeData("1word_US.txt");
            //Console.WriteLine("Conpleted.");
            //p.clear();
            //files = Directory.GetFiles(path, "*.txt",
            //                             SearchOption.AllDirectories);
            //Console.WriteLine("Processing 2 word US....");
            //st = Stopwatch.StartNew();
            //page = "";
            //foreach (string link in files)
            //{
            //    page = File.ReadAllText(link);
            //    p.xuly2(PreProcessing.ConvertToUnSign(page));
            //}
            //st.Stop();
            //Console.WriteLine("Processed, time to elapse: " + st.Elapsed);
            //Console.WriteLine("Writing data...");
            //p.writeData("2word_US.txt");
            //Console.WriteLine("Conpleted.");
            //p.clear();
            //files = Directory.GetFiles(path, "*.txt",
            //                             SearchOption.AllDirectories);
            //Console.WriteLine("Processing 3 word US....");
            //st = Stopwatch.StartNew();
            //page = "";
            //foreach (string link in files)
            //{
            //    page = File.ReadAllText(link);
            //    p.xuly3(PreProcessing.ConvertToUnSign(page));
            //}
            //st.Stop();
            //Console.WriteLine("Processed, time to elapse: " + st.Elapsed);
            //Console.WriteLine("Writing data...");
            //p.writeData("3word_US.txt");
            //Console.WriteLine("Conpleted.");
            //p.clear();

            //Stopwatch st = new Stopwatch();
            //Probability pb = new Probability();
            //Console.WriteLine("reading 1word data...");
            //st = Stopwatch.StartNew();
            //pb.readData(@"1word.txt", @"1word_US.txt");
            //st.Stop();
            //Console.WriteLine("Completed. Elapsed time: " + st.Elapsed);
            //Console.WriteLine("Calculating...");
            //st = Stopwatch.StartNew();
            //pb.calculatingP();
            //st.Stop();
            //Console.WriteLine("Completed. Elapsed time: " + st.Elapsed);
            //Console.WriteLine("Writing...");
            //pb.writeData(@"1word_P.txt");
            //Console.WriteLine("Completed");
            //Console.WriteLine("reading 2word data...");
            //st = Stopwatch.StartNew();
            //pb.readData(@"2word.txt", @"2word_US.txt");
            //st.Stop();
            //Console.WriteLine("Completed. Elapsed time: " + st.Elapsed);
            //Console.WriteLine("Calculating...");
            //st = Stopwatch.StartNew();
            //pb.calculatingP();
            //st.Stop();
            //Console.WriteLine("Completed. Elapsed time: " + st.Elapsed);
            //Console.WriteLine("Writing...");
            //pb.writeData(@"2word_P.txt");
            //Console.WriteLine("Completed");
            //Console.WriteLine("reading 3word data...");
            //st = Stopwatch.StartNew();
            //pb.readData(@"3word.txt", @"3word_US.txt");
            //st.Stop();
            //Console.WriteLine("Completed. Elapsed time: " + st.Elapsed);
            //Console.WriteLine("Calculating...");
            //st = Stopwatch.StartNew();
            //pb.calculatingP();
            //st.Stop();
            //Console.WriteLine("Completed. Elapsed time: " + st.Elapsed);
            //Console.WriteLine("Writing...");
            //pb.writeData(@"3word_P.txt");
            //Console.WriteLine("Completed");

            Test t = new Test();
            t.readData("1word.txt", "2word.txt");
            Console.WriteLine("Processing...");
            Stopwatch st = Stopwatch.StartNew();
            t.process();
            st.Stop();
            Console.WriteLine("Writing data...");
            t.writeData("testdata.txt");
            Console.WriteLine("Completed.");


            //Console.WriteLine("Ok. Press any key to continue.");
            //Console.ReadKey();
            
        }
    }
}
